﻿namespace CodeBetter.Extensions
{
    using System;

    public static class EpochExtensions
    {
        private static readonly DateTime _epoch = new DateTime(1970, 1, 1, 0, 0, 0, 0);
        
        public static double ToEpochMilliseconds(this DateTime date)
        {
            return date.Subtract(_epoch).TotalMilliseconds;
        }
        public static double ToEpochSeconds(this DateTime date)
        {
            return date.Subtract(_epoch).TotalSeconds;
        }
    }
}
